package com.blank.model;

import java.io.Serializable;
import java.util.Arrays;

/**
 * 考试成绩类。考卷为随机抽取的三道题。
 */
public class TestReport implements Serializable {

    private static final long serialVersionUID = -4609889510764558054L;

    /**
     * 本次考试的考题集合
     */
    private Quiz[] quizList = new Quiz[3];

    /**
     * 本次考试学员的回答
     */
    private String[] studentAnswer = new String[3];

    /**
     * 分数
     */
    private int grade;

    /**
     * 考生用户名
     */
    private String username;

    public Quiz[] getQuizList() {
        return quizList;
    }

    public void setQuizList(Quiz[] quizList) {
        this.quizList = quizList;
    }

    public String[] getStudentAnswer() {
        return studentAnswer;
    }

    public void setStudentAnswer(String[] studentAnswer) {
        this.studentAnswer = studentAnswer;
    }

    public int getGrade() {
        return grade;
    }

    public void setGrade(int grade) {
        this.grade = grade;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("--------------------考试成绩报告-----------------------");
        sb.append("\n学员的用户名：");
        sb.append(username);
        sb.append("\n考试题和答案：\n");
        for (Quiz quiz : quizList) {
            sb.append(quiz);
            sb.append("\n");
        }
        sb.append("学员的回答：");
        sb.append(Arrays.toString(studentAnswer));
        sb.append("\n");
        sb.append("最终成绩：");
        sb.append(grade);
        sb.append("/3\n");
        sb.append("-------------------------------------------");
        return sb.toString();
    }
}
